/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"4A406AC8-A1BA-49EF-9D6C-F56BD482D920"}
 */
function cerrar(event) {
	var $res = globals.DIALOGS.showQuestionDialog('Confirme','¿Está seguro que desea cerrar esta orden de compra?','Si','No')
	if ($res == 'Si')
		oc_estado = 6
	filtrar()
}

/**
 * @properties={typeid:24,uuid:"419D2AA5-6394-407B-94D9-404E3DF7B4B0"}
 * @AllowToRunInFind
 */
function filtrar()
{
	controller.find()
	
	oc_estado = 3
	controller.newRecord()
	oc_estado = 4
	
	controller.search()
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"06C8F41C-C7E7-4666-977C-B18E075104AB"}
 */
function iraDtl(event) {
	forms.oc_cabecera_dtl_dlg.controller.loadRecords(oc_cabecera_id)
	globals.formEnVentana('oc_cabecera_dtl_dlg','OC','Orden de Compra Nº '+ nro_oc)
}

/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"44D067B7-1ED6-49D9-9309-6331D653FBEB"}
 */
function onShow(firstShow, event) {
	databaseManager.revertEditedRecords()
	databaseManager.setAutoSave(true)
	filtrar()
}
